package demo;

import java.util.Comparator;
import java.util.PriorityQueue;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-06-23
 * Time: 13:15
 */
public class TestHeap {


    public static void main(String[] args) {
        PriorityQueue<Integer> pq = new PriorityQueue<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2-o1;
            }
        });
        int[] array = {1,2,3,4,5,6,7,8,9,10};
        for(int num:array){
            pq.offer(num);
        }
        for(int i =0;i<3;++i){
            System.out.println(pq.poll());
        }
    }


    public static void main1(String[] args) {
        int[] array = {27,15,19,18,28,34,65,49,25,37};
        Heap heap = new Heap();
        heap.createHeap(array);
        heap.offer(80);
        heap.poll();
    }

}
